import * as React from "react";
import "./index.less";

export default class Test extends React.Component<any, any> {
  static defaultProps = {
    name: "ごうだ たけし"
  };

  constructor(props: any) {
    super(props);
    this.state = this.props;
  }

  handleNameChanged = (name: string) => {
    this.setState({ name });
  };

  render() {
    const { dataWidgetPath } = this.props;
    return (
      <div className="qmBar test" data-widget-path={dataWidgetPath}>
        <div className="qmGroup" data-widget-path={dataWidgetPath}>
          <input
            placeholder="请输入姓名"
            onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
              this.handleNameChanged(e.target.value);
            }}
          />
          <p>你好，{this.state.name}</p>
        </div>
      </div>
    );
  }
}
